﻿Imports Publics
Public Class FrmGetKey

    Private _KeyValue As Integer
    Public Property KeyValue() As Integer
        Get
            Return _KeyValue

        End Get
        Set(ByVal value As Integer)
            _KeyValue = value

        End Set
    End Property
    Private _KeyData As String
    Public Property KeyData() As String
        Get
            Return _KeyData


        End Get
        Set(ByVal value As String)
            _KeyData = value

        End Set
    End Property
    Private Sub FrmGetKey_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        'If e.KeyCode <> Windows.Forms.Keys.Enter Then
        Dim lstCheckPhim As New List(Of Integer)
        lstCheckPhim.Add(13)
        lstCheckPhim.Add(8)
        lstCheckPhim.Add(17)
        lstCheckPhim.Add(18)
        lstCheckPhim.Add(91)
        lstCheckPhim.Add(93)
        lstCheckPhim.Add(40)
        lstCheckPhim.Add(38)
        lstCheckPhim.Add(37)
        lstCheckPhim.Add(36)
        lstCheckPhim.Add(33)
        lstCheckPhim.Add(34)
        lstCheckPhim.Add(35)
        lstCheckPhim.Add(46)
        lstCheckPhim.Add(45)
        lstCheckPhim.Add(19)
        lstCheckPhim.Add(192)
        lstCheckPhim.Add(9)
        lstCheckPhim.Add(20)
        lstCheckPhim.Add(16)
        lstCheckPhim.Add(17)

        If lstCheckPhim.Contains(e.KeyValue) Then
            MsgInfo("Bạn không được chọn kí tự đặc biệt")
            Exit Sub
        Else
            lblPhim.Text = KeyCodeToChar(e.KeyValue)
            _KeyData = KeyCodeToChar(e.KeyValue)
            _KeyValue = e.KeyValue
        End If
        ' End If
    End Sub

    Private Sub FrmGetKey_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            lblPhim.Text = KeyCodeToChar(KeyValue)
        _KeyData = KeyCodeToChar(KeyValue)
    End Sub

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        Me.Close()
    End Sub
End Class